package com.atstudy.headline.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.util.Date;

/**
 * 广告受众统计表
 * @TableName ad_audience_stats
 */
@TableName(value ="ad_audience_stats")
@Data
public class AdAudienceStats {
    /**
     * ID
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 统计日期
     */
    private Date statDate;

    /**
     * 广告计划ID
     */
    private Integer campaignId;

    /**
     * 性别编码(为NULL表示所有性别)
     */
    private Integer genderCode;

    /**
     * 性别类型
     */
    private String genderType;

    /**
     * 年龄段(如"20-30",为NULL表示所有年龄段)
     */
    private String ageRange;

    /**
     * 展示次数
     */
    private Integer impressionCount;

    /**
     * 点击次数
     */
    private Integer clickCount;

    /**
     * 转化次数
     */
    private Integer conversionCount;

    /**
     * 创建时间
     */
    private Date createTime;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        AdAudienceStats other = (AdAudienceStats) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getStatDate() == null ? other.getStatDate() == null : this.getStatDate().equals(other.getStatDate()))
            && (this.getCampaignId() == null ? other.getCampaignId() == null : this.getCampaignId().equals(other.getCampaignId()))
            && (this.getGenderCode() == null ? other.getGenderCode() == null : this.getGenderCode().equals(other.getGenderCode()))
            && (this.getGenderType() == null ? other.getGenderType() == null : this.getGenderType().equals(other.getGenderType()))
            && (this.getAgeRange() == null ? other.getAgeRange() == null : this.getAgeRange().equals(other.getAgeRange()))
            && (this.getImpressionCount() == null ? other.getImpressionCount() == null : this.getImpressionCount().equals(other.getImpressionCount()))
            && (this.getClickCount() == null ? other.getClickCount() == null : this.getClickCount().equals(other.getClickCount()))
            && (this.getConversionCount() == null ? other.getConversionCount() == null : this.getConversionCount().equals(other.getConversionCount()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getStatDate() == null) ? 0 : getStatDate().hashCode());
        result = prime * result + ((getCampaignId() == null) ? 0 : getCampaignId().hashCode());
        result = prime * result + ((getGenderCode() == null) ? 0 : getGenderCode().hashCode());
        result = prime * result + ((getGenderType() == null) ? 0 : getGenderType().hashCode());
        result = prime * result + ((getAgeRange() == null) ? 0 : getAgeRange().hashCode());
        result = prime * result + ((getImpressionCount() == null) ? 0 : getImpressionCount().hashCode());
        result = prime * result + ((getClickCount() == null) ? 0 : getClickCount().hashCode());
        result = prime * result + ((getConversionCount() == null) ? 0 : getConversionCount().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", statDate=").append(statDate);
        sb.append(", campaignId=").append(campaignId);
        sb.append(", genderCode=").append(genderCode);
        sb.append(", genderType=").append(genderType);
        sb.append(", ageRange=").append(ageRange);
        sb.append(", impressionCount=").append(impressionCount);
        sb.append(", clickCount=").append(clickCount);
        sb.append(", conversionCount=").append(conversionCount);
        sb.append(", createTime=").append(createTime);
        sb.append("]");
        return sb.toString();
    }
}
